/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package jlibrarian.interfaces;

import jlibrarian.entities.Book;
import jlibrarian.entities.Rent;
import jlibrarian.entities.Customer;
import java.util.Collection;


/**
 *
 * @author MantaEx
 */
public interface RentManager
{
    /**
     * This method creates new rent in DB.
     * @param rent New rent
     */
    Rent createRent(Rent rent);
    
    /**
     * This method updates given entry.
     * @param rent Rent to update.
     */
    boolean updateRent(Rent rent);
    
    /**
     * This method deletes rent from DB.
     * @param rent Rent to delete.
     */
    boolean deleteRent(Rent rent);
    
    
    
     Collection<Rent> getAllRents();
     
     Collection<Rent> getAllRents(boolean inArchive);
     
     Rent findRentById(int rid);
             
    /**
     * This method searches currently borrowed books.
     * @param book Books to look for.
     * @return Collection of loans.
     */
    Collection<Rent> findRentsByBook(Book book);
    
    /**
     * This method searches currently borrowed books.
     * @param book Books to look for.
     * @param searchInReturned Whether to look into closed loans.
     * @return Collection of loans.
     */
    Collection<Rent> findRentsByBook(Book book, boolean searchInReturned);
    
    int findNumberOfCurrentRentsByBook(Book book);
    
    /**
     * This method searches in customers current loans.
     * @param customer Customer
     * @return Collection of loans.
     */
    Collection<Rent> findRentsByCustomer(Customer customer);
    
    /**
     * This method searches in customers current loans.
     * @param customer Customer
     * @param searchInReturned Whether to look into closed loans.
     * @return Collection of loans.
     */
    Collection<Rent> findRentsByCustomer(Customer customer, boolean searchInReturned);
}
